package ru.evreke.service

import Game
import io.ktor.server.websocket.*
import java.util.concurrent.ConcurrentHashMap

interface State {
    val gameIdToPendingGame: ConcurrentHashMap<String, Game>
    val gameIdToActiveGame: ConcurrentHashMap<String, Game>
    val playerIdToWebSocketSession: ConcurrentHashMap<String, DefaultWebSocketServerSession>

    fun getPendingGames(): ConcurrentHashMap<String, Game>
    fun getActiveGames(): ConcurrentHashMap<String, Game>
    fun getWebsocketSessions(): ConcurrentHashMap<String, DefaultWebSocketServerSession>
    fun addPendingGame(gameId: String, game: Game)
    fun addActiveGame(gameId: String, game: Game)
    fun addWebsocketSession(playerId: String, webSocketSession: DefaultWebSocketServerSession)
    fun removePendingGame(gameId: String)
    fun removeActiveGame(gameId: String)
    suspend fun removeWebsocketSession(playerId: String)
}